<? 
if(isset($_POST['btnsubmit']))
{
 	require("required/dbconnect.php");
	require("required/function.php");
	$album_name_eng=$_POST['album_name_eng'];
	$cat_id=$_POST['cat_id'];
	$id=$_POST['hidid'];
	$update=mysql_query("update os_photoalbum set album_name_eng='$album_name_eng',cat_id='$cat_id' where id=$id")or die(mysql_error());
	header("Location:photo_album.php?action=3");	
}
	$title="Add Album"; 
	$pageid="3";
	$accessid="a00";
	
	require("required/dbconnect.php");	
	require("required/header.php");
	require("required/function.php");
	
	$id=$_GET['id'];
	$get_album=mysql_query("select * from os_photoalbum where id=$id");
	
	if(mysql_num_rows($get_album)==0)
	{
		die("illegal operation!");
	}
	
	
?>
<table width="100%"  cellpadding="0" cellspacing="5" height="300">
				
					<td width="16%" valign="top">
						<? require("required/menu.php") ?>
					</td>
					<td width="84%" align="left" valign="top">
<table width="80%" cellpadding="2" cellspacing="1">
	<tr height="20"  >
		<td colspan="2" class="title">Edit Album</td>
	</tr>
	<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post" name="frm">
	<tr>
		<td>Album Name</td><td><input type="text" maxlength="200" name="album_name_eng" class="text" value="<?= mysql_result($get_album,0,"album_name_eng") ?>" size="50"></td>
	</tr>
    <tr>
        <td>Category</td><td>
        <?
            $get_cat=mysql_query("select * from os_gallery_category order by cat_name asc");
        ?>
        <select name="cat_id">
            <option>Please select</option>
            <?
                while($c=mysql_fetch_array($get_cat,MYSQL_ASSOC))
                {
					if($c['id']==mysql_result($get_album,0,"cat_id"))
					{
						$slt="selected";
					}
					else
					{
						$slt="";
					}
            ?>
            <option value="<?= $c['id'] ?>" <?= $slt ?>><?= $c['cat_name'] ?></option>
            <? } ?>
        </select>
        
        </td>
    </tr>
	
	<input type="hidden" value="<?= $id ?>" name="hidid">
	<tr>
		<td colspan="2"><input type="submit" value="Update" class="button" name="btnsubmit"></td>
	</tr>
	</form>
</table>
</td>
</table>
<? require("required/footer.php"); ?>

